<?php 
require_once("../include/conn.php");
require_once("../include/page.php");

$page=$_GET['page'];
$perpage=20;
$sql_all="select count(*) from   $tb_bm ";
$con   =   mysql_db_query($db_name,$sql_all);   
$num   =   mysql_result($con,0);   //   统计当前总的记录数   
$list=new page($num,$page,$perpage);  
$strartrow=$list->getStartRow();
$sql   =   "select   *   from    $tb_bm  order  by   id   DESC   limit $strartrow,$perpage";   //从上面的起点开始查询出20条数据   
$cn_ma   =   mysql_db_query($db_name,$sql);       
?>
<html>
<head>
<title>信息管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="Admin_Style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
</head>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%"  border="0" cellpadding="0" cellspacing="2">
  <tr class="topbg">
    <th colspan="5">信息管理</th>
  </tr>
  <tr>
   <td width="4%">&nbsp;</td>
    <td width="28%">&nbsp;</td>
    <td width="46%">&nbsp;</td>
    <td width="10%">&nbsp;</td>
    <td width="12%">&nbsp;</td>
  </tr>
  <tr class="tdbg">
    <td>序号</td>
	<td>栏目名称</td>
    <td>上级栏目名称</td>
    <td>栏目级别</td>
    <td>操作</td>
  </tr>
  <?php
  $i=1;
   while($row_ma = mysql_fetch_array($cn_ma))
   {	
		
	?>
  <tr class="tdbg">
  	<td><?php echo $i; ?></td>
    <td><?php echo $row_ma[buname]; ?></td>
    <td>
    <?php if($row_ma[id]<11) {?>顶级栏目<? }
    else {		
		$sqll   =   "select   *   from   $tb_bm  where id='".$row_ma[parentid]."'";
		$conl   =   mysql_db_query($db_name,$sqll);  		
		//echo $row_ma[buname];
		if($rowl = mysql_fetch_row($conl)){		
			if($rowl[3]!==0)
			{
				$sqlf   =   "select   *   from   $tb_bm  where id='".$rowl[3]."'";
				$conf   =   mysql_db_query($db_name,$sqlf);  
				if($rowf = mysql_fetch_row($conf)){	
						
					echo $rowf[1]."->";
				}
			}
			
			echo $rowl[1];
			//print_r($row11);
		}
    }
    ?>
    
    </td>
    <td><?php 
	if($row_ma[isindex]==1) echo "<span style='color:yellow;'>一级栏目</span>";	
	else if($row_ma[isindex]==2)  echo "<span style='color:blue;'>二级栏目</span>";	
	else if($row_ma[isindex]==3)  echo "<span style='color:green;'>三级栏目</span>";
	else  echo "<span style='color:red;'>特殊栏目</span>";		
	?></td>
    <td>
    <?php if($row_ma[id]>10 && $row_ma[id]!=22  && $row_ma[id]!=23  && $row_ma[id]!=24 ) {?>
    <a href="Admin_lanmu.php?id=<?=$row_ma[id];?>&action=update">修改</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="update_lanmu.php?id=<?=$row_ma[id];?>&action=delete" title="千万要注意哟,删除请将此栏目下的所有信息移到其它栏目，否则也将被一起删除!">永久删除</a>
    <? }else{ echo "<span style='color:red;'>不允许修改</span>";}?>
    </td>
  </tr>
<?php
$i++;
 }?>  
  <tr  align="center">
    <td colspan="4" style="font-size:20px;"><?php echo $list->showPageList()?> </td>
  </tr>  
</table>
</body>
</html>
